package com.fivetiger.controller;

import com.fivetiger.dto.PetsFlag;
import com.fivetiger.entity.PetsMaintenance;
import com.fivetiger.service.impl.PetsMaintenanceServiceImpl;
import com.fivetiger.vo.PageBean;
import com.fivetiger.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/api/petsmaintenance/")
public class PetsMaintenanceController {

    @Autowired
    private PetsMaintenanceServiceImpl service;

    @RequestMapping("insert.do")
    @ResponseBody
    public R insert(PetsMaintenance pets){

        return service.insert(pets);
    }

    @RequestMapping("all.do")
    @ResponseBody
    public PageBean all(int page , int limit){
        return service.selectPage(page,limit);
    }

    @RequestMapping("selectByName.do")
    @ResponseBody
    public PageBean selectByName(int page , int limit){
        return service.selectPage(page,limit);
    }

    @RequestMapping("update.do")
    @ResponseBody
    public R update(PetsMaintenance petsMaintenance){
        return service.change(petsMaintenance);
    }

    @RequestMapping("delete.do")
    @ResponseBody
    public R delete(PetsMaintenance petsMaintenance){
        return service.delete(petsMaintenance);
    }


    @RequestMapping("updateByName.do")
    @ResponseBody
    public R updateByName(PetsFlag petsFlag){
        return service.changeByName(petsFlag);
    }


}
